package io.renren.common.vo;

public class RV {
	private String code ;
	private String msg ;
	private Boolean success = true;
	/**
	 * 返回结果
	 */
	private Object data;
	
	public RV(){
		
	}
	public RV(String code,String msg) {
		super();
		this.code = code;
		this.msg = msg;
	}

	/**
	 * 带结果的成功
	 * @param result
	 * @return
     */
	public static RV ok(Object result) {
		RV r = new RV("200","success");
		r.setSuccess(true);
		r.setData(result);
		return r;
		
	}

	/**
	 * 成功
	 * @return
     */
	public static RV ok() {
		RV rv = new RV("200","success");
		rv.setSuccess(true);
		return rv;
	}

	/**
	 * 失败信息
	 * @param code
	 * @param msg
     * @return RV
     */
	public static RV fail(String code,String msg) {
		RV rv = new RV(code,msg);
		rv.setSuccess(false);
		//rv.setResult(result);
		return rv;
	}
	
	/**
	 * 失败信息
	 * @param code
	 * @param msg
     * @return RV
     */
	public static RV fail(String msg) {
		RV rv = new RV("500","fail");
		rv.setSuccess(false);
		rv.setMsg(msg);
		return rv;
	}
	
	
	
	public String getCode() {
		return code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	public String getMsg() {
		return msg;
	}
	public void setMsg(String msg) {
		this.msg = msg;
	}
	public Boolean getSuccess() {
		return success;
	}
	public void setSuccess(Boolean success) {
		this.success = success;
	}
	public Object getData() {
		return data;
	}
	public void setData(Object data) {
		this.data = data;
	}
}
